package com.smag.system.mapper;

import com.smag.common.core.domain.entity.FarmCategory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
* @author hzqhzq
* @description 针对表【farm_category(分类表)】的数据库操作Mapper
* @createDate 2023-03-31 10:19:04
* @Entity com.ruoyi.common.core.domain.entity.FarmCategory
*/
public interface FarmCategoryMapper extends BaseMapper<FarmCategory> {
    /**
     * 查询种类
     *
     * @param id 种类主键
     * @return 种类
     */
    public FarmCategory selectFarmCategoryById(Long id);

    /**
     * 查询种类列表
     *
     * @param farmCategory 种类
     * @return 种类集合
     */
    public List<FarmCategory> selectFarmCategoryList(FarmCategory farmCategory);

    /**
     * 新增种类
     *
     * @param farmCategory 种类
     * @return 结果
     */
    public int insertFarmCategory(FarmCategory farmCategory);

    /**
     * 修改种类
     *
     * @param farmCategory 种类
     * @return 结果
     */
    public int updateFarmCategory(FarmCategory farmCategory);

    /**
     * 删除种类
     *
     * @param id 种类主键
     * @return 结果
     */
    public int deleteFarmCategoryById(Long id);

    /**
     * 批量删除种类
     *
     * @param id 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFarmCategoryByIds(Long id);

    public int hasChildByCategoryById(Long id);

    FarmCategory checkCategoryNameUnique(@Param("name") String name, @Param("pid") Long pid);

    int selectNormalChildrenCategoryById(Long categoryId);

    public List<FarmCategory> selectChildrenCategoryById(Long categoryId);


    public int updateCategoryChildren(@Param("children") List<FarmCategory> children);

    public void updateCategoryStatusNormal(Long[] categoryIds);

    List<Long> selectCategoryListByCropId(Long cropId, boolean categoryCheckStrictly);


}




